package gui;

import javax.swing.JPanel;
import java.awt.Color;
import javax.swing.JLabel;
import java.awt.Font;

import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import javax.swing.SwingConstants;

//		Login screen
public class Login extends JPanel {

	private JTextField textfieldLogin;
	private JPasswordField textfieldPassword;
	private JLabel labelLogo;
	private JButton btnLogin;
	private JLabel lblBcbsSystemsThe;
	private JButton btnHelp;
	private JLabel lblError;

	public Login() {

		setBounds(0, 0, 624, 921);
		setBackground(new Color(135, 206, 235));
		setLayout(null);

		Icon logo = new ImageIcon(getClass().getResource(
				"LOGOHighassfuck2.0.png"));

		lblError = new JLabel("Incorrect Email or password. Please try again.");
		lblError.setForeground(new Color(128, 0, 0));
		lblError.setHorizontalAlignment(SwingConstants.CENTER);
		lblError.setFont(new Font("Calibri Light", Font.PLAIN, 20));
		lblError.setBounds(95, 485, 423, 26);
		lblError.setVisible(false);
		add(lblError);

		labelLogo = new JLabel();
		labelLogo.setIcon(logo);
		labelLogo.setBounds(85, 45, 484, 465);
		add(labelLogo);

		textfieldLogin = new JTextField();
		textfieldLogin.setHorizontalAlignment(SwingConstants.CENTER);
		textfieldLogin.setForeground(new Color(192, 192, 192));
		textfieldLogin.setFont(new Font("Calibri Light", Font.PLAIN, 35));
		textfieldLogin.setText("CBS Email");
		textfieldLogin.setBounds(49, 521, 520, 112);
		add(textfieldLogin);
		textfieldLogin.setColumns(10);

		textfieldPassword = new JPasswordField();
		textfieldPassword.setHorizontalAlignment(SwingConstants.CENTER);
		textfieldPassword.setForeground(new Color(192, 192, 192));
		textfieldPassword.setFont(new Font("Calibri Light", Font.PLAIN, 35));
		textfieldPassword.setText("Password");
		textfieldPassword.setBounds(49, 632, 520, 112);
		textfieldPassword.setColumns(10);
		add(textfieldPassword);

		btnHelp = new JButton();
		btnHelp.setForeground(Color.DARK_GRAY);
		btnHelp.setFont(new Font("Calibri Light", Font.PLAIN, 19));
		btnHelp.setText("Help");
		btnHelp.setBounds(272, 850, 69, 43);
		add(btnHelp);

		btnLogin = new JButton("Login");
		btnLogin.setForeground(Color.DARK_GRAY);
		btnLogin.setFont(new Font("Calibri Light", Font.PLAIN, 35));
		btnLogin.setBounds(178, 765, 255, 80);
		add(btnLogin);

		lblBcbsSystemsThe = new JLabel(
				"BCBS Systems, the \"Bitcoin\" logo, and all related systems are copyright Copenhagen Business School and its affiliates ");
		lblBcbsSystemsThe.setForeground(Color.DARK_GRAY);
		lblBcbsSystemsThe.setFont(new Font("Calibri", Font.PLAIN, 8));
		lblBcbsSystemsThe.setBounds(113, 900, 394, 14);
		add(lblBcbsSystemsThe);

	}

	public JButton getLogin() {
		return btnLogin;
	}

	public JTextField getTextfieldEMAIL() {
		return textfieldLogin;
	}

	public JPasswordField getPasswordfieldPASSWORD() {
		return textfieldPassword;
	}

	public JButton getHelpCenter() {
		return btnHelp;
	}

	public JLabel getError() {
		return lblError;
	}

	public void addActionListener(ActionListener teemo) {
		btnLogin.addActionListener(teemo);
		btnHelp.addActionListener(teemo);
	}
}
